Component({
    externalClasses: [ "complate-class", "close-btn-class", "complate-text-class" ],
    properties: {
        show: {
            value: !1,
            type: Boolean
        },
        extraKey: {
            value: "",
            type: String
        },
        theme: {
            value: "default",
            type: String
        },
        title: {
            value: "",
            type: String
        },
        closeButtonText: {
            value: "",
            type: String
        },
        amountModel: {
            value: !1,
            type: Boolean
        },
        numberKeyBoardCloseFn: {
            type: Function
        },
        maxlength: {
            value: 999,
            type: Number
        }
    },
    data: {
        passKeyArr: [ {
            value: 1,
            type: "number"
        }, {
            value: 2,
            type: "number"
        }, {
            value: 3,
            type: "number"
        }, {
            value: 4,
            type: "number"
        }, {
            value: 5,
            type: "number"
        }, {
            value: 6,
            type: "number"
        }, {
            value: 7,
            type: "number"
        }, {
            value: 8,
            type: "number"
        }, {
            value: 9,
            type: "number"
        }, {
            value: "icon-jianpan",
            type: "hidden"
        }, {
            value: 0,
            type: "number"
        }, {
            value: "icon-fontclass-guanbi",
            type: "deleteBtn"
        } ],
        passValueArr: []
    },
    ready: function() {
        if ("" != this.data.extraKey) {
            var e = {
                value: this.data.extraKey,
                type: "number"
            }, t = this.data.passKeyArr;
            t.splice(9, 1, e), this.setData({
                passKeyArr: t
            });
        }
        if ("custom" == this.data.theme) {
            var a = this.data.passKeyArr;
            a.pop();
            a.splice(9, 1, {
                value: 0,
                type: "number"
            }), a.splice(10, 1, {
                value: ".",
                type: "number"
            }), this.setData({
                passKeyArr: a
            });
        }
    },
    methods: {
        handClickPass: function(e) {
            var t = e.currentTarget.dataset, a = t.value, s = t.type;
            if ("number" == s) {
                if (this.data.passValueArr.length >= this.data.maxlength) {
                    var r = this.getFloatNum();
                    if (!("." == a && this.data.amountModel || this.data.amountModel && -1 != r && r < 2)) return;
                }
                if (this.data.amountModel && "." == a) {
                    if (0 == this.data.passValueArr.length) return;
                    if (this.data.passValueArr.includes(".")) return;
                }
                if (this.data.amountModel) if (this.getFloatNum() >= 2) return;
                this.data.passValueArr.push(a);
            } else if ("deleteBtn" == s) this.data.passValueArr.pop(); else if ("hidden" == s) return void this.handHiddenKeyboard();
            var u = this.data.passValueArr;
            this.setData({
                passValueArr: u
            }), this.triggerEvent("input", {
                passValueArr: u,
                value: a,
                type: s
            });
        },
        handHiddenKeyboard: function() {
            var e = this.data.numberKeyBoardCloseFn;
            if (e && "function" == typeof e && !e()) return;
            this.setData({
                show: !1
            }), this.triggerEvent("hide");
        },
        getFloatNum: function() {
            var e = this.data.passValueArr.indexOf(".");
            e >= 0 && (e++, e = this.data.passValueArr.length - e);
            return e;
        }
    }
});